package org.jeecg.modules.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.entity.ZkEquipmentService;
import org.jeecg.modules.system.entity.ZkEquipmentServiceDetail;

/**
 * @Description: 设备信息表
 * @Author: jeecg-boot
 * @Date:   2024-04-29
 * @Version: V1.0
 */
public interface ZkEquipmentServiceMapper extends BaseMapper<ZkEquipmentService> {
    /**
     * 审批界面/维修（根据当前登录人和状态分页查询）
     * @param page     分页参数
     * @param id       当前登录人
     * @return
     */
    @Select("select * from zk_equipment_service_detail where aud_personnel_id=#{id} and service_status=1")
    IPage<ZkEquipmentServiceDetail> queryZkEquipmentServiceDetail(Page<ZkEquipmentServiceDetail> page, @Param("Id") String id);

    /**
     * 发起界面/维修（根据当前登录人和状态分页查询）
     * @param page     分页参数
     * @param id       当前登录人
     * @return
     */
    @Select("select * from zk_equipment_service_detail where service_personnel_id=#{id} and service_status=1")
    IPage<ZkEquipmentServiceDetail> queryZkEquipmentServiceList(Page<ZkEquipmentServiceDetail> page, @Param("Id") String id);

    /**
     * 抄送任务(维修)（根据当前登录人和状态将维修，保养，检修放在同一个分页查询中）
     */
    @Select("SELECT * from zk_equipment_service_detail where cc_personnel_id=#{id} and if_cc=1")
    IPage<ZkEquipmentServiceDetail> queryZkEquipmentServiceCc(Page<ZkEquipmentServiceDetail> page, @Param("Id") String id);

}
